In [1]:
from pearce.emulator import OriginalRecipe, ExtraCrispy
from pearce.mocks import cat_dict
import numpy as np
from os import path
In [2]:
import matplotlib
#matplotlib.use('Agg')
from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set()
In [3]:
training_file = '/u/ki/swmclau2/des/PearceRedMagicWpCosmo2.hdf5'
em_method = 'gp'
split_method = 'random'
In [4]:
a = 1.0
z = 1.0/a - 1.0
In [5]:
fixed_params = {'z':z, 'r': 0.19118072}
In [7]:
emu = OriginalRecipe(training_file, method = em_method, fixed_params=fixed_params, downsample_factor=0.12)#,
#hyperparams = {'n_estimators': 500,
# 'max_depth': 5})
In [8]:
emu.scale_bin_centers
Out[8]:
In [9]:
#print emu.x.shape
#print emu.downsample_x.shape
if hasattr(emu, "_emulators"):
print emu._emulators[0]._x.shape
else:
print emu._emulator._x.shape
In [10]:
emu._ordered_params
Out[10]:
In [11]:
emu.train_metric()
In [ ]:
%%timeit
#truth_file = '/u/ki/swmclau2/des/PearceRedMagicWpCosmoTest.hdf5'
gof = emu.goodness_of_fit(training_file, N = 100, statistic = 'log_frac')
In [ ]:
gof = emu.goodness_of_fit(training_file, N = 1000, statistic = 'log_frac')
In [ ]:
print gof.mean(axis =0)
In [ ]:
plt.plot(emu.scale_bin_centers, np.abs(gof.mean(axis = 0)) )
plt.plot(emu.scale_bin_centers, np.ones_like(emu.scale_bin_centers)*0.01)
plt.plot(emu.scale_bin_centers, np.ones_like(emu.scale_bin_centers)*0.05)
plt.plot(emu.scale_bin_centers, np.ones_like(emu.scale_bin_centers)*0.1)
plt.loglog();
In [ ]:
plt.plot(emu.scale_bin_centers, np.abs(gof.T),alpha = 0.1, color = 'b')
plt.plot(emu.scale_bin_centers, np.ones_like(emu.scale_bin_centers)*0.01, lw = 2, color = 'k')
plt.loglog();
In [ ]: